<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('付款申请总经理审批')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">付款申请总经理审批</li>
    </ol>
    <div class="aLine"></div>
</div>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
<!--                        <li>-->
<!--                            <label>劳务合同：</label>-->
<!--                            <input type="text" name="aTheLabor"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>劳务金额：</label>-->
<!--                            <input type="text" name="aLaborCost"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>供应商名称/应付单位名称：</label>-->
<!--                            <input type="text" name="aSupplierName"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>申请人：</label>-->
<!--                            <input type="text" name="aProposer"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>申请内容：</label>-->
<!--                            <input type="text" name="aApplicationContent"/>-->
<!--                        </li>-->
<!--                        <li class="select-time">-->
<!--                            <label>申请时间：</label>-->
<!--                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginACreateTime]"/>-->
<!--                            <span>-</span>-->
<!--                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endACreateTime]"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>父建项目总表id：</label>-->
<!--                            <input type="text" name="pId"/>-->
<!--                        </li>-->
                        <li>
                            <label>项目名称：</label>
                            <input type="text" name="pName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('ruoyi:contract:edit')}]];
    var removeFlag = [[${@permission.hasPermi('ruoyi:contract:remove')}]];
    var creadFlag = [[${@permission.hasPermi('ruoyi:contract:add')}]];
    var eStatus = [[${@dict.getType('payment_status')}]];
    var prefix = ctx + "ruoyi/finance";
    var prefixs = ctx + "system/building";
    var aprefix =ctx + "ruoyi/paymentVerify";

    $(function() {
        var options = {
            url: prefixs + "/list",
            createUrl: aprefix + "/add/{id}",
            removeUrl: aprefix + "/remove",
            exportUrl: prefix + "/export",
            updateUrl: aprefix + "/edit/{id}",
            modalName:"付款申请总经理审批列表",
            showColumns: false,
            detailView: true,
            mobileResponsive: false,
            cardView: true,
            onExpandRow: function (index, row, $detail) {
                initChildTable(index, row, $detail);
            },
            columns: [
                {
                    field: 'pId',
                    title: '项目id',
                    visible: false
                },
                {
                    field: 'pName',
                    title: '项目名称',
                },
                {
                    field: 'pFounder',
                    title: '创建者',
                },
                {
                    field: 'pTime',
                    title: '创建时间',
                },
            ]
        };
        $.table.init(options);
    });
    initChildTable = function (index, row, $detail) {
        var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
        $(childTable).bootstrapTable({
                url: aprefix + "/listss",
                method: 'post',
                sidePagination: "server",
                contentType: "application/x-www-form-urlencoded",
                queryParams: {
                    sId:row.pId
                },
                columns: [

                    {
                        field: 'aTheLabor',
                        title: '劳务合同',
                        width: 100,
                    },
                    {
                        field: 'aLaborCost',
                        title: '劳务金额',
                        width: 100,
                    },
                    {
                        field: 'aProposer',
                        title: '申请人',
                        width: 100,
                    },
                    {
                        field: 'aSupplierName',
                        title: '供应商/应付单位名称',
                        width: 150,
                    },
                    {
                        field: 'aApplicationContent',
                        title: '申请内容',
                        width: 100,
                    },
                    {
                        field: 'aCreateTime',
                        title: '申请时间',
                        width: 100,
                    },
                    {
                        field: 'aStatus',
                        title: '申请状态',
                        width: 100,
                        align: "center",
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(eStatus, value);
                        }
                    },
                    {
                        field: 'aOpinion',
                        title: '审批意见',
                        width: 100,
                    },
                    {
                        title: '操作',
                        width: 100,
                        align: 'center',
                        formatter: function(value, row, index) {
                            var actions = [];
                            if (row.aStatus ==1){
                                actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="consent(\'' + row.aId + '\')"><i class="fa fa-user"></i> 通过</a> ');
                                actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.aId + '\')"><i class="fa fa-edit"></i>驳回</a> ');
                            }
                            return actions.join('');
                        }
                    }]
            }
        );
    };
    function consent(aId) {

        $.modal.confirm("确认要通过申请吗?", function() {
            var url = aprefix + "/consent";
            var data = { "id": aId };
            $.operate.submit(url, "post", "json", data);
        });
    }
</script>
</body>
</html>